package com.zhuss.controller.product;

import com.zhuss.bean.bo.product.preline.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.product.preline.PrelineOperateServiceExt;
import com.zhuss.exception.DzcxException;


/**
 * @description: 招募操作的Controller
 * @author: mkh
 * @create: Mon Jan 04 13:38:02 CST 2021
 **/
@RestController
@RequestMapping("/preline")
public class PrelineOperateController extends BaseController {
	
	@Autowired
	@Qualifier("prelineOperateService")
	private OperateService<Void, Object> prelineOperateService;
	
	@Autowired
	@Qualifier("prelineOperateServiceExt")
	private PrelineOperateServiceExt prelineOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreatePrelineBo bo) throws DzcxException {
		
		prelineOperateService.create(bo);
    }

	/**
	 * 根据线路绑定站点
	 * @param bo
	 * @return
	 * @throws DzcxException
	 */
	@ResponseBody
	@RequestMapping("/bind")
	public void bind(@RequestBody BindPrelineBo bo) throws DzcxException {

		prelineOperateServiceExt.bind(bo);
	}
	
	/**
	 * 修改
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdatePrelineBo bo) throws DzcxException {
		
		prelineOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeletePrelineBo bo) throws DzcxException {
		
		prelineOperateService.delete(bo);
    }
	/**
	 * 启用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/start")
	public void start(@RequestBody StartPrelineBo bo) throws DzcxException {

		prelineOperateServiceExt.start(bo);
	}


	/**
	 * 停用
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
	@PostMapping("/stop")
	public void stop(@RequestBody StopPrelineBo bo) throws DzcxException {

		prelineOperateServiceExt.stop(bo);
	}
}
